<?php
/*
	
*/
defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();

if($_RQ['op']=='list'){
	if($_RQ['brand']){
		$params['brand like']='%'.trim($_RQ['brand']).'%';
		$return['params']['brand']=$_RQ['brand'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 15;
	$total='';
	$list=pdo_getslice('jy_carapi_brand',$params,array($pindex,$psize),$total,$fields);
	if($list){
		foreach($list as &$row){
			$row['imgs']='../addons/jy_carapi/resource/images/'.$row['imgs'];
		}
	}
	$return['list']=$list?$list:array();
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>array(
			'0'=>array('op'=>'list','title'=>'品牌列表'),
		),
		'list'=>array('data'=>'list','delall'=>false,'del_one'=>false,'edit'=>false,'list'=>array(
			array('name'=>'id','title'=>'ID','type'=>'string'),
			array('name'=>'brand','title'=>'品牌名称','type'=>'string'),
			array('name'=>'imgs','title'=>'LOGO','type'=>'image'),
		)),
		'search_one'=>array('name'=>'brand','add'=>false)
		
	);
	$return['htmls']=$htmls;
	exi($return);
}
